package com.my.chapter14;

import java.util.Arrays;
import java.util.List;

public class practice3 {
    public static void main(String[] args) {
        List<Shape> shapes = Arrays.asList(
                new Circle(), new Square(), new Triangle(),
                new Rhomboid()
        );
        for(Shape shape:shapes){
            System.out.println(shape);
        }
        Rhomboid rhomboid = (Rhomboid) shapes.get(3);
    }
}

class Shape{
    @Override
    public String toString() {
        return "Shape";
    }
}

class Circle extends Shape {
    @Override
    public String toString() {
        return "Circle";
    }
}

class Square extends Shape {
    @Override
    public String toString() {
        return "Square";
    }
}

class Triangle extends Shape {
    @Override
    public String toString() {
        return "Triangle";
    }
}

class Rhomboid extends Shape {
    public String toString() { return "Rhomboid"; }
}
